﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/Core.Master" AutoEventWireup="true"
    CodeBehind="InstallmentsPayment.aspx.cs" Inherits="Pap.Web.Modules.Loan.Views.InstallmentsPayment"
    meta:resourcekey="PageResource1" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ext:Store runat="server" ID="storePaymentsHistory" AutoLoad="True" IDMode="Legacy"
        meta:resourcekey="storePaymentsHistoryResource1" SerializationMode="Simple">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="PaymentDate" Type="Date" />
                    <ext:RecordField Name="PaymentAmount" />
                    <ext:RecordField Name="ReceiptNumber" />
                    <ext:RecordField Name="InstallmentDueDate" Type="Date" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:FitLayout runat="server" IDMode="Legacy" meta:resourcekey="FitLayoutResource1">
        <ext:Panel runat="server" meta:resourcekey="PanelResource1">
            <Body>
                <ext:RowLayout runat="server">
                    <ext:LayoutRow RowHeight="0.33">
                        <ext:FormPanel ID="panelMain" IDMode="Static" runat="server" meta:resourcekey="panelMainResource1"
                            Frame="true" LabelWidth="120" Icon="MoneyAdd" AutoScroll="true">
                            <Body>
                                <ext:FormLayout ID="FormLayout1" runat="server" meta:resourcekey="FormLayout1Resource1">
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtCustomerName" Disabled="True" meta:resourcekey="txtCustomerNameResource1"
                                            Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtCustomerSSN" Disabled="True" meta:resourcekey="txtCustomerSSNResource1" />
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtLoanNumber" Disabled="True" meta:resourcekey="txtLoanNumberResource1"
                                            Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtInstallmentDueDate" Disabled="True" meta:resourcekey="txtInstallmentDueDateResource1"
                                            Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtPeneltyAmount" Disabled="True" meta:resourcekey="txtPeneltyAmountResource1"
                                            Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:MultiField runat="server" FieldLabel="Payment Date" meta:resourcekey="MultiFieldResource1">
                                            <Fields>
                                                <ext:TextField runat="server" ID="txtPaymentDate" Disabled="True" meta:resourcekey="txtPaymentDateResource1"
                                                    Text="" />
                                                <ext:Button runat="server" ID="btnOldDate" Text="Old Date" Icon="Date" meta:resourcekey="btnOldDateResource1">
                                                    <AjaxEvents>
                                                        <Click OnEvent="BtnOldDate_Clicked">
                                                            <EventMask Msg="<%$Resources:MSGLoading %>" ShowMask="true" />
                                                        </Click>
                                                    </AjaxEvents>
                                                </ext:Button>
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                    <ext:Anchor>
                                        <ext:TextField runat="server" ID="txtReceiptNumber" AllowBlank="False" FieldLabel="Receipt Number"
                                            meta:resourcekey="txtReceiptNumberResource1" MaxLength="18" Regex="^[0-9]+$" />
                                    </ext:Anchor>
                                    <ext:Anchor>
                                        <ext:TextField runat="server" ID="txtDueAmount" Disabled="True" FieldLabel="Due Amount"
                                            meta:resourcekey="txtDueAmountResource1" Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor>
                                        <ext:TextField runat="server" ID="txtChangeAmount" Disabled="True" FieldLabel="Change Amount"
                                            meta:resourcekey="txtChangeAmountResource1" Text="" />
                                    </ext:Anchor>
                                    <ext:Anchor>
                                        <ext:NumberField runat="server" ID="txtPaymentAmount" MinValue="1" AllowNegative="False"
                                            FieldLabel="Payment Amount" AllowBlank="False" meta:resourcekey="txtPaymentAmountResource1">
                                            <AjaxEvents>
                                                <Change OnEvent="TxtPaymentAmount_Changed">
                                                    <EventMask Target="Parent" />
                                                </Change>
                                            </AjaxEvents>
                                        </ext:NumberField>
                                    </ext:Anchor>
                                </ext:FormLayout>
                            </Body>
                            <BottomBar>
                                <ext:StatusBar runat="server" IDMode="Static" meta:resourcekey="StatusBar1Resource1"
                                    Flat="true">
                                    <Plugins>
                                        <ext:ValidationStatus ID="wndpnlValidation" FormPanelID="panelMain" ValidIcon="Accept"
                                            ErrorIcon="Exclamation" runat="server" meta:resourcekey="pnlValidationResource1" />
                                    </Plugins>
                                    <Items>
                                        <ext:Button runat="server" ID="btnPay" Text="Pay" Icon="MoneyAdd" IDMode="Static"
                                            meta:resourcekey="btnPayResource1" OnClientClick="">
                                            <AjaxEvents>
                                                <Click OnEvent="BtnPay_Clicked" Before="return #{panelMain}.getForm().isValid();">
                                                    <EventMask Target="Page" />
                                                </Click>
                                            </AjaxEvents>
                                        </ext:Button>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
                        </ext:FormPanel>
                    </ext:LayoutRow>
                    <ext:LayoutRow RowHeight="1">
                        <ext:Panel runat="server" Frame="true">
                            <Body>
                                <ext:FitLayout runat="server">
                                    <ext:GridPanel runat="server" ID="grvPayments" Title="Payments History" StripeRows="true"
                                        StoreID="storePaymentsHistory" meta:resourcekey="grvPaymentsResource1" AutoExpandColumn="PaymentAmount">
                                        <SelectionModel>
                                            <ext:RowSelectionModel runat="server">
                                            </ext:RowSelectionModel>
                                        </SelectionModel>
                                        <ColumnModel>
                                            <Columns>
                                                <ext:Column DataIndex="ReceiptNumber" Header="<%$Resources:HeaderReceiptNumber %>"
                                                    Sortable="True" />
                                                    <ext:Column DataIndex="InstallmentDueDate" Header="<%$Resources:txtInstallmentDueDateResource1.FieldLabel %>" Sortable="True">
                                                    <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                                                </ext:Column>
                                                <ext:Column DataIndex="PaymentDate" Header="<%$Resources:HeaderPaymentDate %>" Sortable="True">
                                                    <Renderer Fn="Ext.util.Format.dateRenderer('d/m/Y')" />
                                                </ext:Column>
                                                <ext:Column DataIndex="PaymentAmount" Header="<%$Resources:HeaderPaymentValue %>"
                                                    Sortable="True" />
                                            </Columns>
                                        </ColumnModel>
                                        <BottomBar>
                                            <ext:PagingToolbar ID="pagingBar" runat="server" StoreID="storePaymentsHistory" PageSize="15"
                                                DisplayInfo="True" IDMode="Static" meta:resourcekey="pagingBarResource1">
                                            </ext:PagingToolbar>
                                        </BottomBar>
                                    </ext:GridPanel>
                                </ext:FitLayout>
                            </Body>
                        </ext:Panel>
                    </ext:LayoutRow>
                </ext:RowLayout>
            </Body>
            <BottomBar>
                <ext:StatusBar runat="server">
                    <Items>
                        <ext:Button runat="server" ID="btnClose" Text="<%$Resources:btnCloseText %>" Icon="ArrowUndo">
                            <AjaxEvents>
                                <Click OnEvent="btnClose_Clicked" />
                            </AjaxEvents>
                        </ext:Button>
                    </Items>
                </ext:StatusBar>
            </BottomBar>
        </ext:Panel>
    </ext:FitLayout>
    <ext:Window runat="server" ID="wndOldPayment" ShowOnLoad="false" AutoHeight="true"
        Width="400px" Modal="true" Title="<%$Resources:wndOldDatePayment%>">
        <Body>
            <ext:FormPanel runat="server" ID="wndPanel" AutoScroll="true" Frame="true">
                <Body>
                    <ext:FormLayout ID="FormLayout2" runat="server">
                        <ext:Anchor Horizontal="95%">
                            <ext:DateField runat="server" ID="dateOldDate" FieldLabel="Old Date" AllowBlank="false"
                                meta:resourcekey="dateOldDateResource" />
                        </ext:Anchor>
                        <ext:Anchor Horizontal="95%">
                            <ext:TextArea runat="server" ID="txtNotes" AllowBlank="false" meta:resourcekey="txtNotesResource"
                                Regex="^[0-9A-zء-ي' '\n]+$" FieldLabel="Notes" />
                        </ext:Anchor>
                    </ext:FormLayout>
                </Body>
                <BottomBar>
                    <ext:StatusBar ID="StatusBar2" runat="server" Flat="true">
                        <Items>
                            <ext:Button runat="server" ID="btnSubmitOldDate" Text="Submit" meta:resourcekey="btnSubmitOldDateResource"
                                Icon="Accept">
                                <AjaxEvents>
                                    <Click OnEvent="BtnSubmitOldDate_Clicked" Before="return #{wndPanel}.getForm().isValid();">
                                        <EventMask Msg="loading ..." ShowMask="true" />
                                    </Click>
                                </AjaxEvents>
                            </ext:Button>
                        </Items>
                    </ext:StatusBar>
                </BottomBar>
            </ext:FormPanel>
        </Body>
    </ext:Window>
    <ext:Window runat="server" ID="wndGenerateRecipteNumber" Modal="true" Closable="false"
        ShowOnLoad="false" Width="550px" Height="480px">
        <AutoLoad Mode="IFrame" ShowMask="True" ManuallyTriggered="True" PassParentSize="True" />
        <BottomBar>
            <ext:StatusBar runat="server">
                <Items>
                    <ext:Button runat="server" ID="btnCloseReceipte" Text="<%$Resources:btnCloseReceipteText %>"
                        Icon="Reload">
                        <AjaxEvents>
                            <Click OnEvent="BtnCloseReceipte_Clicked" />
                        </AjaxEvents>
                    </ext:Button>
                </Items>
            </ext:StatusBar>
        </BottomBar>
    </ext:Window>
</asp:Content>
